<template>
  <div class="box">
    <h1>
      A组件,{{ count.money }}
      <el-button type="primary" size="default" @click="handleGold">
        取点黄金打条金链子
      </el-button>
    </h1>
    <div v-for="(item, index) in cart.cartList" :key="index">
      商品名称：{{ item.name }} 价格：{{ item.price }} 数量:{{ item.n }}
      <el-button type="danger" size="small" @click="">删除</el-button>
    </div>
  </div>
</template>

<script setup>
import { useCount } from "../../store/count";
import { useCart } from "../../store/cart";

//数字-状态机
const count = useCount();
const handleGold = () => {
  count.gold = "900kg";
};

//购物车数据
const cart = useCart();
</script>

<style lang="scss" scoped>
.box {
  height: 400px;
  border: 1px solid #0b0808;
  width: 50%;
}
</style>
